<template>
  <div>
    <van-field v-model='form.name' label='功能名称'/>
    <van-button @click='add'>添加</van-button>
    <br><br>
    <table cellspacing="0" align="center" border="6px">
      <tr>
        <td>名称</td>
        <td>操作</td>
      </tr>
      <tr v-for="i in glit">
        <td>{{ i.name }}</td>
        <td>
          <a :href="'/#/info?&id=' + i.id">
            <button>参数配置</button>
          </a>
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
export default {
  name: "test",
  data() {
    return {
      form: {},
      glit: []
    }
  },

  methods: {
    add() {
      this.axios.post('/adds', this.form).then(res => {
        console.log(res)
      })
    },
    getlist() {
      this.axios.get('/adds').then(res => {
        this.glit = res.data.list
      })
    }
  },  

  mounted() {
    this.getlist()
  }
}
</script>

<style scoped>

</style>
